Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pixel density on p5.Image (fixes issue #6114) #6447

Merged
merged 9 commits into from
Oct 12, 2023

Conversation

Gaurav-1306
Copy link
Contributor

@Gaurav-1306 Gaurav-1306 commented Sep 30, 2023

Resolves #6114

Changes:

Created a new method that allowed user to set up the pixel density of the image.

Screenshots of the change:

PR Checklist

@davepagurek davepagurek self-requested a review September 30, 2023 17:31
*/
setPixelDensity(density) {
if (density <= 0) {
console.error('Pixel density must be greater than 0.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a console.error perhaps using the FES would be better here? Or alternatively default to 1 if the value is <= 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented both of the suggested actions for improvement. Kindly review the changes and provide any feedback. Your input is highly valued. Thank you.

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you call graphic.get() on a p5.Graphics (or just call get() for the main canvas), it currently returns a p5.Image at 1x density instead of matching the density of the source object. Would we be able to use this new feature here too?

const region = new p5.Image(w, h);
region.canvas
.getContext('2d')
.drawImage(canvas, x, y, w * pd, h * pd, 0, 0, w, h);

this.canvas.height = this.height * density;

// Update the drawing context
this.drawingContext = this.canvas.getContext('2d');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might not be necessary to get the context again after changing the canvas size

* img.setPixelDensity(2);
* </code></div>
*/
setPixelDensity(density) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could match the API of main canvases and p5.Graphics where pixelDensity() returns the current density, and pixelDensity(newDensity) sets it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me look into what you are saying and get back to you. Thanks for the feedback.

@Gaurav-1306
Copy link
Contributor Author

@davepagurek I have been working on the solution.

The problem:
As you said when we call the get() function it creates an image with pixel density of 1. Now we can change the pixel desity that is hard coded for 1 to anything we like by creating a method pixelDesity() and that can easily change the pd.

now extending the problem.

if we want to use the same function for all the other canvases then I think it should be possible for us to use that as long as it an image we are talking about.

Doubt

p5.prototype.pixelDensity = function(val) {
p5._validateParameters('pixelDensity', arguments);
let returnValue;
if (typeof val === 'number') {
if (val !== this._pixelDensity) {
this._pixelDensity = val;
}
returnValue = this;

In this particular instance, the method pixelDesity already exists. I am a bit confused as to how this function links with the other function. Will the function able to change the pixel density of the image(p5.image) that we are trying to change?

@davepagurek
Copy link
Contributor

I think we won't need to modify the pixelDensity function you linked in core/environment.js, but rather, we can add a similar function to p5.Image. We do that in p5.Framebuffer already here:

pixelDensity(density) {
if (density) {
this.autoSized = false;
this.density = density;
this._handleResize();
} else {
return this.density;
}
}

Rather than having a separate setPixelDensity and pixelDensity for p5.Image, we could give it a combined getter/setter function like that too.

@Gaurav-1306
Copy link
Contributor Author

Gaurav-1306 commented Oct 5, 2023

@davepagurek i made the changes as you said. You can provide the with feedback. one more thing, I think we can use pixeldensity function from anywhere as long as we are doing it on an image. But if we set the following function

this._pixelDensity = 1;

like this._pixelDensity = pixelDensity(); and then define the pixelDensity in the global scope of all the src/files then we can change the pixelDensity in the class of p5.image only.

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we set the following function like this._pixelDensity = pixelDensity(); and then define the pixelDensity in the global scope of all the src/files then we can change the pixelDensity in the class of p5.image only.

I don't think we want to make image pixel densities match the display density by default, because we would be making the image's canvas more dense without having more data to actually fill it with. Say you import a 200x200 image with loadImage(). If we set its density to 2, then we will be making its canvas be 400x400, but the original image is still only 200x200, so we would just be unnecessarily stretching it to 400x400 internally.

I think it probably makes more sense if we always keep the internal image's data the same (since that basically never changes after we import an image), and instead use pixelDensity to determine how we interpret the data. So if you import a 200x200 image, but then say img.pixelDensity(2), then that would make p5 treat it like a 100x100 image, but with enough subpixels that it still displays crisply on a 2x display. This would have to be something users set manually for imported images because we wouldn't know whether an image's "target" size should be, that's up to the user and how they want to use it. @limzykenneth does that make sense to you too?

If we use it that way, then rather than adjusting the canvas size when we set the density, we would instead keep the canvas size the same and adjust the width/height p5 uses:

- this.canvas.width = this.width * density;
- this.canvas.height = this.height * density;
+ this.width /= density;
+ this.height /= density;

Can we also set the pixel density of the image returned by graphic.get()?

const region = new p5.Image(w, h);
region.canvas
.getContext('2d')
.drawImage(canvas, x, y, w * pd, h * pd, 0, 0, w, h);

A test case to make sure that works could be creating a graphic and setting its pixel density to e.g. 3, calling img = graphic.get(), and then checking that img.width === graphic.width, img.height === graphic.height, and img.pixelDensity() === graphic.pixelDensity().

@limzykenneth
Copy link
Member

Yes, the implementation I have in my mind would more or less as @davepagurek described, since we don't want to create or delete pixels from the image loaded in by the user when pixel density is changed we'll change the dimension of the backing canvas instead. Although we probably need to be a bit aware of possible points of confusion and possibly document clearly as necessary.

@Gaurav-1306
Copy link
Contributor Author

pixelDensity to determine how we interpret the data. So if you import a 200x200 image, but then say img.pixelDensity(2), then that would make p5 treat it like a 100x100 image, but with enough subpixels that it still displays crisply on a 2x display. This would have to be something users set manually for imported images because we wouldn't know whether an image's "target" size should be, that's up to the user and how they want to use it

the above point makes sense and in the next commit I will implement so that we don't change the canvas size but rather the the interpretation of the image.

Can we also set the pixel density of the image returned by graphic.get()?

Now coming to this point, i always thought that graphic.get() function returned an image so any method on p5.image should work with this function too, but i guess i need to do testing to make sure this works. So let me read some document and get back to you.

Do you think the ideas I've shared align with what we're discussing? I'd love to hear your thoughts on it

@davepagurek
Copy link
Contributor

Now coming to this point, i always thought that graphic.get() function returned an image so any method on p5.image should work with this function too, but i guess i need to do testing to make sure this works. So let me read some document and get back to you.

Right, I think the change would just be in how we set the default pixel density of images coming from .get(). Currently, it creates an image with less raw pixels than the source canvas if the source canvas has a density greater than 1. We'd like to make it store all the data available and match the pixel density right when you call .get() so that users don't have to then manually call .pixelDensity() on it afterwards (although, like you said, they'd be able to if they want to.)

Do you think the ideas I've shared align with what we're discussing? I'd love to hear your thoughts on it

Remind me which other ideas you're referring to? Is that the idea of having a common implementation of the pixelDensity function across p5.Image, p5.Graphics, p5.Framebuffer, and p5 itself?

@Gaurav-1306
Copy link
Contributor Author

Remind me which other ideas you're referring to. Is that the idea of having a common implementation of the pixelDensity function across p5.Image, p5.Graphics, p5.Framebuffer, and p5 itself?

Nah, I was just referring to the points I mentioned above, to be sure that we are on the same page.
Now that you have mentioned the common implementation if you could elaborate a little, like where will this pixelDensity function reside and other things that you have in mind, that would be really helpful!

@davepagurek
Copy link
Contributor

Ah ok I thought earlier you were maybe talking about having a common implementation. I think it's OK if we don't do that for now since there are some subtle differences in how all these classes work.

Anyway other than that I think what we've been discussing seems right!

@Gaurav-1306
Copy link
Contributor Author

Gaurav-1306 commented Oct 6, 2023

@davepagurek I think i finally solved all the concern.

  1. To begin with I change the height and width of the image canvas to not stretch internally as you suggested in the code.

  2. the get() function - setting the image to same pixel density as that of the image the get function is called on.

const region = new p5.Image(w, h);

in the above line a new image is created and whenever a new image is created then the pixeldesnity of the new image is set of default of 1. To retain the same pixel density of that of the original image I add the following code in the next line.
region._pixelDensity = pd;
this makes the changes necessary for the retention of the pixel value.
following are the screenshots showing that these changes are working.
Screenshot 2023-10-06 at 3 43 26 PM
Screenshot 2023-10-06 at 3 43 42 PM

@@ -159,6 +159,7 @@ class Renderer extends p5.Element {
}

const region = new p5.Image(w, h);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to make it it a new p5.Image(w*pd, h*pd)? I think this currently still reduces the number of pixels if the graphic is higher density. I think we'd also need up update line 165 to be something like:

drawImage(canvas, x, y, w * pd, h * pd, 0, 0, w * pd, h * pd)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I get what you're saying. I've made the changes in the commit. Take a look now—do you think it looks good? Super open to any further tweaks or suggestions!

this._pixelDensity = density;

// Adjust canvas dimensions based on pixel density
this.width /= density;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function looks great now, thanks!

@Gaurav-1306
Copy link
Contributor Author

@davepagurek @limzykenneth
any update on this issue? Can my commits be merged?

@Gaurav-1306 Gaurav-1306 mentioned this pull request Oct 12, 2023
7 tasks
Comment on lines 2 to 6
// put setup code here
// put setup code here
}

function draw() {
// put drawing code here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can changes in this file be reverted as it is not related to the issue being addressed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya let me change them.

@limzykenneth limzykenneth merged commit c5f5abb into processing:main Oct 12, 2023
2 checks passed
@limzykenneth
Copy link
Member

Looks good. Thanks!

@SableRaf SableRaf changed the title fixed the issue #6114 Support pixel density on p5.Image (fixes issue #6114) Oct 12, 2023
AmrikSD referenced this pull request in Potato-Blood/pogo Nov 10, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [p5](https://togithub.com/processing/p5.js) | devDependencies | minor
| [`1.7.0` -> `1.8.0`](https://renovatebot.com/diffs/npm/p5/1.7.0/1.8.0)
|
|
[@types/p5](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/p5)
([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) |
devDependencies | patch | [`1.7.0` ->
`1.7.3`](https://renovatebot.com/diffs/npm/@types%2fp5/1.7.0/1.7.3) |

---

### Release Notes

<details>
<summary>processing/p5.js (p5)</summary>

###
[`v1.8.0`](https://togithub.com/processing/p5.js/releases/tag/v1.8.0)

[Compare
Source](https://togithub.com/processing/p5.js/compare/v1.7.0...v1.8.0)

<!-- Release notes generated using configuration in .github/release.yml
at v1.8.0 -->

#### What's Changed 🎊

##### WebGL

In this release, p5.js added some new WebGL mode tools. Filters now run
in shaders for extra speed, and you can now run custom filter shaders,
even on 2D canvases. You can now cut holes in shapes with
`beginContour()` and apply vector masks with `beginClip()`. You can
reuse shapes more efficiently with `buildGeometry()` and instanced
rendering. Finally, we have also fixed a number of bugs. *- Summary
written by [@&#8203;davepagurek](https://togithub.com/davepagurek) ✨*

- Add support for beginContour() and endContour() in Webgl mode by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6297](https://togithub.com/processing/p5.js/pull/6297)
- Fix stroke rendering when drawing to framebuffers by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6304](https://togithub.com/processing/p5.js/pull/6304)
- Adds createFilterShader() and custom shader support to the webGL
filter() function by
[@&#8203;wong-justin](https://togithub.com/wong-justin) in
[https://github.com/processing/p5.js/pull/6237](https://togithub.com/processing/p5.js/pull/6237)
- Fix WebGL text not rendering when rotated 90 degrees by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6316](https://togithub.com/processing/p5.js/pull/6316)
- Fix reading between nested active framebuffers by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6314](https://togithub.com/processing/p5.js/pull/6314)
- Add methods to construct p5.Geometry from other p5 drawing functions
by [@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6287](https://togithub.com/processing/p5.js/pull/6287)
- Handle missing exact edge vertices in buildGeometry by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6320](https://togithub.com/processing/p5.js/pull/6320)
- Fix strokes on framebuffers with different aspect ratios by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6339](https://togithub.com/processing/p5.js/pull/6339)
- Fix freed geometry leaving attributes in a broken state by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6323](https://togithub.com/processing/p5.js/pull/6323)
- Improve performance of line rendering by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6230](https://togithub.com/processing/p5.js/pull/6230)
- Add support for webGL instancing by
[@&#8203;RandomGamingDev](https://togithub.com/RandomGamingDev) in
[https://github.com/processing/p5.js/pull/6276](https://togithub.com/processing/p5.js/pull/6276)
- Add shaders for filter() constants, and use them by default in P2D by
[@&#8203;wong-justin](https://togithub.com/wong-justin) in
[https://github.com/processing/p5.js/pull/6324](https://togithub.com/processing/p5.js/pull/6324)
- Fix clip() on both the main canvas and framebuffers by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6376](https://togithub.com/processing/p5.js/pull/6376)
- fixed texture filtering bug in p5.Framebuffer by
[@&#8203;KeyboardSounds](https://togithub.com/KeyboardSounds) in
[https://github.com/processing/p5.js/pull/6420](https://togithub.com/processing/p5.js/pull/6420)
- Fix clear() on framebuffers on Intel macs by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6429](https://togithub.com/processing/p5.js/pull/6429)
- Fix textureMode(IMAGE) + beginShape(TESS) by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6366](https://togithub.com/processing/p5.js/pull/6366)
- fixed issue
[#&#8203;6440](https://togithub.com/processing/p5.js/issues/6440) by
[@&#8203;Gaurav-1306](https://togithub.com/Gaurav-1306) in
[https://github.com/processing/p5.js/pull/6446](https://togithub.com/processing/p5.js/pull/6446)
- Erode, dilate, threshold shader filters match closer to CPU filters by
[@&#8203;wong-justin](https://togithub.com/wong-justin) in
[https://github.com/processing/p5.js/pull/6405](https://togithub.com/processing/p5.js/pull/6405)
- Update WebGL blur filter to match CPU blur more by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6460](https://togithub.com/processing/p5.js/pull/6460)
- Fix camera flipping on framebuffers between push/pop calls by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6471](https://togithub.com/processing/p5.js/pull/6471)
- Setuniform by [@&#8203;Gaurav-1306](https://togithub.com/Gaurav-1306)
in
[https://github.com/processing/p5.js/pull/6474](https://togithub.com/processing/p5.js/pull/6474)
- resolved issue
[#&#8203;6399](https://togithub.com/processing/p5.js/issues/6399) by
[@&#8203;Gaurav-1306](https://togithub.com/Gaurav-1306) in
[https://github.com/processing/p5.js/pull/6480](https://togithub.com/processing/p5.js/pull/6480)
- Auto-bind filter shaders to the filter graphic by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6482](https://togithub.com/processing/p5.js/pull/6482)
- new PR for issue
[#&#8203;6383](https://togithub.com/processing/p5.js/issues/6383)(Problem
for diagonal) by
[@&#8203;perminder-17](https://togithub.com/perminder-17) in
[https://github.com/processing/p5.js/pull/6488](https://togithub.com/processing/p5.js/pull/6488)

##### Friendly Error System (FES)

- Add Hindi translation to FES by
[@&#8203;Ayush23Dash](https://togithub.com/Ayush23Dash) in
[https://github.com/processing/p5.js/pull/6272](https://togithub.com/processing/p5.js/pull/6272)
- Re-worded lines 413 and 446 of FES Developer Notes by
[@&#8203;OnexiMedina](https://togithub.com/OnexiMedina) in
[https://github.com/processing/p5.js/pull/6307](https://togithub.com/processing/p5.js/pull/6307)
- Reference FES Contributor Docs inside FES Directory along with a
diagram to understand usages of FES functions by
[@&#8203;Ayush23Dash](https://togithub.com/Ayush23Dash) in
[https://github.com/processing/p5.js/pull/6335](https://togithub.com/processing/p5.js/pull/6335)
- Fixed typing errors in fes_core.js documentation by
[@&#8203;Garima3110](https://togithub.com/Garima3110) in
[https://github.com/processing/p5.js/pull/6478](https://togithub.com/processing/p5.js/pull/6478)
- Update friendly_error_system.md by
[@&#8203;Garima3110](https://togithub.com/Garima3110) in
[https://github.com/processing/p5.js/pull/6481](https://togithub.com/processing/p5.js/pull/6481)
- Update fes_reference_dev_notes.md by
[@&#8203;Garima3110](https://togithub.com/Garima3110) in
[https://github.com/processing/p5.js/pull/6486](https://togithub.com/processing/p5.js/pull/6486)

##### Reference Documentation Update

We updated a group of p5.js Reference pages as part of 2023 Season of
Docs (SoD) program, with a goal to make them more accessible and
beginner-friendly. Thanks to the SoD technical writer
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) ✨.

- Edit docs for math functions by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6281](https://togithub.com/processing/p5.js/pull/6281)
- docs(typography): fix typos in example for textFont by
[@&#8203;meezwhite](https://togithub.com/meezwhite) in
[https://github.com/processing/p5.js/pull/6401](https://togithub.com/processing/p5.js/pull/6401)
- Edit docs for p5.Vector by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6340](https://togithub.com/processing/p5.js/pull/6340)
- Edit docs for pixels functions by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6390](https://togithub.com/processing/p5.js/pull/6390)
- Edit docs for loading & displaying images by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6425](https://togithub.com/processing/p5.js/pull/6425)
- Update docs for p5.Image by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6434](https://togithub.com/processing/p5.js/pull/6434)
- Edit docs for p5.Font by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6453](https://togithub.com/processing/p5.js/pull/6453)
- Edit docs for image by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6424](https://togithub.com/processing/p5.js/pull/6424)
- Edit docs for typography load and display by
[@&#8203;nickmcintyre](https://togithub.com/nickmcintyre) in
[https://github.com/processing/p5.js/pull/6450](https://togithub.com/processing/p5.js/pull/6450)

##### Google Summer of Code (GSoC) 2023 Wrap up

- 🌸 Added GSoC wrap up! by
[@&#8203;dewanshDT](https://togithub.com/dewanshDT) in
[https://github.com/processing/p5.js/pull/6403](https://togithub.com/processing/p5.js/pull/6403)
- Gsoc 23 Wrapup post by
[@&#8203;Ayush23Dash](https://togithub.com/Ayush23Dash) in
[https://github.com/processing/p5.js/pull/6415](https://togithub.com/processing/p5.js/pull/6415)
- add GSoC'23 wrapup post for Justin Wong by
[@&#8203;wong-justin](https://togithub.com/wong-justin) in
[https://github.com/processing/p5.js/pull/6418](https://togithub.com/processing/p5.js/pull/6418)
- Create lichlyter_gsoc\_2023.md by
[@&#8203;katlich112358](https://togithub.com/katlich112358) in
[https://github.com/processing/p5.js/pull/6455](https://togithub.com/processing/p5.js/pull/6455)
- Create munusshih_gsoc\_2023.md by
[@&#8203;munusshih](https://togithub.com/munusshih) in
[https://github.com/processing/p5.js/pull/6461](https://togithub.com/processing/p5.js/pull/6461)

##### Other Code Update

- Ask to disable printing when print() called with no arguments by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6253](https://togithub.com/processing/p5.js/pull/6253)
- fix textWidth() and textToPoints() by
[@&#8203;munusshih](https://togithub.com/munusshih) in
[https://github.com/processing/p5.js/pull/6184](https://togithub.com/processing/p5.js/pull/6184)
- Fix issue where nf with 0 'right' parameter returns undefined in
string by [@&#8203;limzykenneth](https://togithub.com/limzykenneth) in
[https://github.com/processing/p5.js/pull/6291](https://togithub.com/processing/p5.js/pull/6291)
- Update environment.js with fix for frameRate description by
[@&#8203;quinton-ashley](https://togithub.com/quinton-ashley) in
[https://github.com/processing/p5.js/pull/6269](https://togithub.com/processing/p5.js/pull/6269)
- Implement clip() to shapes by
[@&#8203;davepagurek](https://togithub.com/davepagurek) in
[https://github.com/processing/p5.js/pull/6306](https://togithub.com/processing/p5.js/pull/6306)
- Clarified workflow for contributing documentation by
[@&#8203;thatguyseven](https://togithub.com/thatguyseven) in
[https://github.com/processing/p5.js/pull/6312](https://togithub.com/processing/p5.js/pull/6312)
- Clears MediaElement canvas at the beginning of every frame by
[@&#8203;donaldzhu](https://togithub.com/donaldzhu) in
[https://github.com/processing/p5.js/pull/6309](https://togithub.com/processing/p5.js/pull/6309)
- Clean up gruntfile release related steps by
[@&#8203;Qianqianye](https://togithub.com/Qianqianye) in
[https://github.com/processing/p5.js/pull/6321](https://togithub.com/processing/p5.js/pull/6321)
- fix-return-type by
[@&#8203;asukaminato0721](https://togithub.com/asukaminato0721) in
[https://github.com/processing/p5.js/pull/6326](https://togithub.com/processing/p5.js/pull/6326)
- fix HALF_FLOAT by
[@&#8203;asukaminato0721](https://togithub.com/asukaminato0721) in
[https://github.com/processing/p5.js/pull/6330](https://togithub.com/processing/p5.js/pull/6330)
- Added .gitattributes to Increase compatability with Window users and
line endings by [@&#8203;SilasVM](https://togithub.com/SilasVM) in
[https://github.com/processing/p5.js/pull/6317](https://togithub.com/processing/p5.js/pull/6317)
- update all contributors setup by
[@&#8203;gr2m](https://togithub.com/gr2m) in
[https://github.com/processing/p5.js/pull/6341](https://togithub.com/processing/p5.js/pull/6341)
- refine canvas' type by
[@&#8203;asukaminato0721](https://togithub.com/asukaminato0721) in
[https://github.com/processing/p5.js/pull/6328](https://togithub.com/processing/p5.js/pull/6328)
- MouseEvent, WheelEvent and KeyboardEvent type by
[@&#8203;asukaminato0721](https://togithub.com/asukaminato0721) in
[https://github.com/processing/p5.js/pull/6329](https://togithub.com/processing/p5.js/pull/6329)
- fixed-wrong-capture-size-and-freeze-issue by
[@&#8203;Prateek93a](https://togithub.com/Prateek93a) in
[https://github.com/processing/p5.js/pull/5159](https://togithub.com/processing/p5.js/pull/5159)
- add more event type by
[@&#8203;asukaminato0721](https://togithub.com/asukaminato0721) in
[https://github.com/processing/p5.js/pull/6379](https://togithub.com/processing/p5.js/pull/6379)
- Main by [@&#8203;j-adel](https://togithub.com/j-adel) in
[https://github.com/processing/p5.js/pull/6374](https://togithub.com/processing/p5.js/pull/6374)
- Update labeler Github Action by
[@&#8203;stampyzfanz](https://togithub.com/stampyzfanz) in
[https://github.com/processing/p5.js/pull/6395](https://togithub.com/processing/p5.js/pull/6395)
- add unregisterMethod function by
[@&#8203;capGoblin](https://togithub.com/capGoblin) in
[https://github.com/processing/p5.js/pull/6426](https://togithub.com/processing/p5.js/pull/6426)
- add before/after preload and setup by
[@&#8203;capGoblin](https://togithub.com/capGoblin) in
[https://github.com/processing/p5.js/pull/6433](https://togithub.com/processing/p5.js/pull/6433)
- Fix: Misleading error message when NaN passed by
[@&#8203;capGoblin](https://togithub.com/capGoblin) in
[https://github.com/processing/p5.js/pull/6464](https://togithub.com/processing/p5.js/pull/6464)
- Support pixel density on p5.Image (fixes issue
[#&#8203;6114](https://togithub.com/processing/p5.js/issues/6114)) by
[@&#8203;Gaurav-1306](https://togithub.com/Gaurav-1306) in
[https://github.com/processing/p5.js/pull/6447](https://togithub.com/processing/p5.js/pull/6447)
- Fix orphan canvas when sketch is removed before canvas creation by
[@&#8203;limzykenneth](https://togithub.com/limzykenneth) in
[https://github.com/processing/p5.js/pull/6355](https://togithub.com/processing/p5.js/pull/6355)

##### Other Documentation Update

- Fixed GitHub capitalization typo in contributor_docs by
[@&#8203;SilasVM](https://togithub.com/SilasVM) in
[https://github.com/processing/p5.js/pull/6284](https://togithub.com/processing/p5.js/pull/6284)
- Fixing typo in "What are issues?" by
[@&#8203;snwarner22](https://togithub.com/snwarner22) in
[https://github.com/processing/p5.js/pull/6288](https://togithub.com/processing/p5.js/pull/6288)
- Fixed GitHub spelling in CONTRIBUTING.md by
[@&#8203;SilasVM](https://togithub.com/SilasVM) in
[https://github.com/processing/p5.js/pull/6295](https://togithub.com/processing/p5.js/pull/6295)
- Fixed grammatical errors in contributor_guidelines.md by
[@&#8203;thatguyseven](https://togithub.com/thatguyseven) in
[https://github.com/processing/p5.js/pull/6296](https://togithub.com/processing/p5.js/pull/6296)
- Update documentation_style_guide.md with new guideline by
[@&#8203;zelf0](https://togithub.com/zelf0) in
[https://github.com/processing/p5.js/pull/6334](https://togithub.com/processing/p5.js/pull/6334)
- add missing code contributors to all contributors in README and
`.all-contributors.rc` file by [@&#8203;gr2m](https://togithub.com/gr2m)
in
[https://github.com/processing/p5.js/pull/6349](https://togithub.com/processing/p5.js/pull/6349)
- docs(all-contributors): remove
[@&#8203;stellartux](https://togithub.com/stellartux) as requested by
[@&#8203;gr2m](https://togithub.com/gr2m) in
[https://github.com/processing/p5.js/pull/6368](https://togithub.com/processing/p5.js/pull/6368)
- docs(src/utilities): Use `describe()` instead of `@alt` by
[@&#8203;Zearin](https://togithub.com/Zearin) in
[https://github.com/processing/p5.js/pull/5598](https://togithub.com/processing/p5.js/pull/5598)
- Fix typo in export path to fix dev mode by
[@&#8203;mykongee](https://togithub.com/mykongee) in
[https://github.com/processing/p5.js/pull/6373](https://togithub.com/processing/p5.js/pull/6373)
- Improve Readme for future Contributors to codebase by
[@&#8203;Ayush23Dash](https://togithub.com/Ayush23Dash) in
[https://github.com/processing/p5.js/pull/6260](https://togithub.com/processing/p5.js/pull/6260)
- Fixed mousePressed() Example Error by
[@&#8203;Utkarsh3128](https://togithub.com/Utkarsh3128) in
[https://github.com/processing/p5.js/pull/6413](https://togithub.com/processing/p5.js/pull/6413)
- Update README.md by
[@&#8203;katlich112358](https://togithub.com/katlich112358) in
[https://github.com/processing/p5.js/pull/6458](https://togithub.com/processing/p5.js/pull/6458)
- Fixed typing errors in validate_params.js file's documentation by
[@&#8203;Garima3110](https://togithub.com/Garima3110) in
[https://github.com/processing/p5.js/pull/6473](https://togithub.com/processing/p5.js/pull/6473)
- typo and unused variable from core by
[@&#8203;benschac](https://togithub.com/benschac) in
[https://github.com/processing/p5.js/pull/6476](https://togithub.com/processing/p5.js/pull/6476)

#### New Contributors 💗

- [@&#8203;munusshih](https://togithub.com/munusshih) made their first
contribution in
[https://github.com/processing/p5.js/pull/6184](https://togithub.com/processing/p5.js/pull/6184)
- [@&#8203;SilasVM](https://togithub.com/SilasVM) made their first
contribution in
[https://github.com/processing/p5.js/pull/6284](https://togithub.com/processing/p5.js/pull/6284)
- [@&#8203;snwarner22](https://togithub.com/snwarner22) made their first
contribution in
[https://github.com/processing/p5.js/pull/6288](https://togithub.com/processing/p5.js/pull/6288)
- [@&#8203;thatguyseven](https://togithub.com/thatguyseven) made their
first contribution in
[https://github.com/processing/p5.js/pull/6296](https://togithub.com/processing/p5.js/pull/6296)
- [@&#8203;OnexiMedina](https://togithub.com/OnexiMedina) made their
first contribution in
[https://github.com/processing/p5.js/pull/6307](https://togithub.com/processing/p5.js/pull/6307)
- [@&#8203;donaldzhu](https://togithub.com/donaldzhu) made their first
contribution in
[https://github.com/processing/p5.js/pull/6309](https://togithub.com/processing/p5.js/pull/6309)
- [@&#8203;gr2m](https://togithub.com/gr2m) made their first
contribution in
[https://github.com/processing/p5.js/pull/6341](https://togithub.com/processing/p5.js/pull/6341)
- [@&#8203;RandomGamingDev](https://togithub.com/RandomGamingDev) made
their first contribution in
[https://github.com/processing/p5.js/pull/6276](https://togithub.com/processing/p5.js/pull/6276)
- [@&#8203;mykongee](https://togithub.com/mykongee) made their first
contribution in
[https://github.com/processing/p5.js/pull/6373](https://togithub.com/processing/p5.js/pull/6373)
- [@&#8203;j-adel](https://togithub.com/j-adel) made their first
contribution in
[https://github.com/processing/p5.js/pull/6374](https://togithub.com/processing/p5.js/pull/6374)
- [@&#8203;meezwhite](https://togithub.com/meezwhite) made their first
contribution in
[https://github.com/processing/p5.js/pull/6401](https://togithub.com/processing/p5.js/pull/6401)
- [@&#8203;dewanshDT](https://togithub.com/dewanshDT) made their first
contribution in
[https://github.com/processing/p5.js/pull/6403](https://togithub.com/processing/p5.js/pull/6403)
- [@&#8203;Utkarsh3128](https://togithub.com/Utkarsh3128) made their
first contribution in
[https://github.com/processing/p5.js/pull/6413](https://togithub.com/processing/p5.js/pull/6413)
- [@&#8203;KeyboardSounds](https://togithub.com/KeyboardSounds) made
their first contribution in
[https://github.com/processing/p5.js/pull/6420](https://togithub.com/processing/p5.js/pull/6420)
- [@&#8203;capGoblin](https://togithub.com/capGoblin) made their first
contribution in
[https://github.com/processing/p5.js/pull/6426](https://togithub.com/processing/p5.js/pull/6426)
- [@&#8203;Gaurav-1306](https://togithub.com/Gaurav-1306) made their
first contribution in
[https://github.com/processing/p5.js/pull/6446](https://togithub.com/processing/p5.js/pull/6446)
- [@&#8203;katlich112358](https://togithub.com/katlich112358) made their
first contribution in
[https://github.com/processing/p5.js/pull/6455](https://togithub.com/processing/p5.js/pull/6455)
- [@&#8203;Garima3110](https://togithub.com/Garima3110) made their first
contribution in
[https://github.com/processing/p5.js/pull/6473](https://togithub.com/processing/p5.js/pull/6473)
- [@&#8203;benschac](https://togithub.com/benschac) made their first
contribution in
[https://github.com/processing/p5.js/pull/6476](https://togithub.com/processing/p5.js/pull/6476)
- [@&#8203;perminder-17](https://togithub.com/perminder-17) made their
first contribution in
[https://github.com/processing/p5.js/pull/6488](https://togithub.com/processing/p5.js/pull/6488)
- [@&#8203;lakshay451](https://togithub.com/lakshay451) made their first
contribution in
[https://github.com/processing/p5.js/pull/6493](https://togithub.com/processing/p5.js/pull/6493)

**Full Changelog**:
processing/p5.js@v1.7.0...v1.8.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMS4wIiwidXBkYXRlZEluVmVyIjoiMzcuMzUuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: Renovate Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support pixel density on p5.Image
3 participants